/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.mlbs.entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author mckd87
 */
@Entity
@Table(name = "pagecache")
@NamedQueries({@NamedQuery(name = "Pagecache.findById", query = "SELECT p FROM Pagecache p WHERE p.id = :id"), @NamedQuery(name = "Pagecache.findByPage", query = "SELECT p FROM Pagecache p WHERE p.page = :page"), @NamedQuery(name = "Pagecache.findByPageValue", query = "SELECT p FROM Pagecache p WHERE p.pageValue = :pageValue"), @NamedQuery(name = "Pagecache.findByDateCreated", query = "SELECT p FROM Pagecache p WHERE p.dateCreated = :dateCreated"), @NamedQuery(name = "Pagecache.findByCacheIndex", query = "SELECT p FROM Pagecache p WHERE p.cacheIndex = :cacheIndex")})
public class Pagecache implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Column(name = "id", nullable = false)
    private Integer id;
    @Column(name = "page")
    private String page;
    @Column(name = "pageValue")
    private String pageValue;
    @Column(name = "dateCreated")
    @Temporal(TemporalType.DATE)
    private Date dateCreated;
    @Column(name = "cacheIndex")
    private Integer cacheIndex;
    @JoinColumn(name = "deviceId", referencedColumnName = "deviceid")
    @ManyToOne
    private Device deviceId;
    @JoinColumn(name = "appId", referencedColumnName = "appId")
    @ManyToOne
    private Preferences appId;

    public Pagecache() {
    }

    public Pagecache(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getPage() {
        return page;
    }

    public void setPage(String page) {
        this.page = page;
    }

    public String getPageValue() {
        return pageValue;
    }

    public void setPageValue(String pageValue) {
        this.pageValue = pageValue;
    }

    public Date getDateCreated() {
        return dateCreated;
    }

    public void setDateCreated(Date dateCreated) {
        this.dateCreated = dateCreated;
    }

    public Integer getCacheIndex() {
        return cacheIndex;
    }

    public void setCacheIndex(Integer cacheIndex) {
        this.cacheIndex = cacheIndex;
    }

    public Device getDeviceId() {
        return deviceId;
    }

    public void setDeviceId(Device deviceId) {
        this.deviceId = deviceId;
    }

    public Preferences getAppId() {
        return appId;
    }

    public void setAppId(Preferences appId) {
        this.appId = appId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Pagecache)) {
            return false;
        }
        Pagecache other = (Pagecache) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.mlbs.entity.Pagecache[id=" + id + "]";
    }

}
